/**
 * 
 */
package com.keggview.application.datatypes;

import java.util.ArrayList;

import org.dom4j.Element;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.Resource;

/**
 * The pathway element specifies graph information stored in the KEGG pathway
 * map. The attributes of this element are as follows.
 * 
 * The pathway element is a root element, and one pathway element is specified
 * for one pathway map in KGML. The entry, relation, and reaction elements
 * specify the graph information, and additional elements are used to specify
 * more detailed information about nodes and edges of the graph.
 * 
 * @author Pablo
 * 
 */
public class Pathway extends Base {

	/**
	 * (required) The name attribute contains the KEGG identifier of this
	 * pathway map.<br>
	 * 
	 * examples of name of pathway: the KEGGID of this pathway map:<br>
	 * name="path:map00010"<br>
	 * name="path:ko00010"<br>
	 * name="path:hsa00010"<br>
	 * format:<br>
	 * path:map[0-9]{5}<br>
	 * path:ko[0-9]{5}<br>
	 * path:[org prefix][0-9]{5}<br>
	 * where [0-9]{5} represents the pathway map number and [org prefix] is a
	 * three-letter species code in KEGG
	 */
	private String name;

	/**
	 * (required) The org attribute specifies the classification of this pathway
	 * map. The distinction of reference pathways and pathways for various
	 * organisms is made according to the attribute value.<br>
	 * 
	 * attribute value:<br> - map : the reference metabolic pathway map
	 * represented by EC numbers<br>
	 *  - ko : the reference pathway map represented by KO identifiers<br>
	 *  - [org prefix] : the organism-specific pathway map for "org"<br>
	 *  - mim : the human pathway map with disease genes in OMIM<br>
	 * 
	 */
	private String org;

	/**
	 * (required) The number attribute specifies the five-digit pathway map
	 * number.<br>
	 * format:<br>
	 * 
	 * [0-9]{5} : number="00030"
	 */
	private String number;

	/**
	 * (implied) The title attribute specifies the title of this pathway map.
	 * 
	 * example:
	 * 
	 * title="Pentose phosphate pathway"
	 */
	private String title;

	/**
	 * (implied) The image attribute specifies the resource location of the
	 * image file for this pathway map in the KEGG Web service.<br>
	 * 
	 * URL image="http://www.genome.jp/kegg/pathway/map/map00010.gif"
	 */
	private String image;

	/**
	 * (implied) The link attribute specifies the resource location of the
	 * information about this pathway map in the KEGG Web service.
	 * 
	 * example:<br>
	 * URL link="http://www.genome.jp/dbget-bin/show_pathway?map00030"
	 */
	private String link;

	/**
	 * list of entries. [0,n)
	 */
	private ArrayList<Entry> entries;
	
	/**
	 * list of reactions [0,n)
	 */
	private ArrayList<Reaction> reactions;
	
	/**
	 * list of relations
	 */
	private ArrayList<Relation> relations;
	
	public Pathway(Element element) {
		this.name = element.attribute("name").getValue();
		this.org = element.attribute("org").getValue();
		this.number = element.attribute("number").getValue();
		this.title = element.attribute("title").getValue();
		this.image = element.attribute("image").getValue();
		this.link = element.attribute("link").getValue();
	}
	
	/**
	 * @param name
	 * @param org
	 * @param number
	 * @param title
	 * @param image
	 * @param link
	 */
	public Pathway(String name, String org, String number, String title,
			String image, String link) {
		this.name = name;
		this.org = org;
		this.number = number;
		this.entries = new ArrayList<Entry>(0);
		this.reactions = new ArrayList<Reaction>(0);
		this.relations = new ArrayList<Relation>(0);

		if (title == null) {
			this.title = new String("");
		} else {
			this.title = title;
		}

		if (image == null) {
			this.image = new String("");
		} else {
			this.image = image;
		}

		if (link == null) {
			this.link = new String("");
		} else {
			this.link = link;
		}
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the org
	 */
	public String getOrg() {
		return org;
	}

	/**
	 * @param org
	 *            the org to set
	 */
	public void setOrg(String org) {
		this.org = org;
	}

	/**
	 * @return the number
	 */
	public String getNumber() {
		return number;
	}

	/**
	 * @param number
	 *            the number to set
	 */
	public void setNumber(String number) {

		this.number = number;

	}

	/**
	 * @return the title
	 */
	public String getTitle() {

		return title;

	}

	/**
	 * @param title
	 *            the title to set
	 */
	public void setTitle(String title) {

		this.title = title;

	}

	/**
	 * @return the image
	 */
	public String getImage() {

		return image;

	}

	/**
	 * @param image
	 *            the image to set
	 */
	public void setImage(String image) {

		this.image = image;

	}

	/**
	 * @return the link
	 */
	public String getLink() {

		return link;

	}

	/**
	 * @param link
	 *            the link to set
	 */
	public void setLink(String link) {

		this.link = link;

	}

	/**
	 * @return the entries
	 */
	public ArrayList<Entry> getEntries() {
		return entries;
	}

	/**
	 * @param entries the entries to set
	 */
	public void setEntries(ArrayList<Entry> entries) {
		this.entries = entries;
	}

	/**
	 * @return the reactions
	 */
	public ArrayList<Reaction> getReactions() {
		return reactions;
	}

	/**
	 * @param reactions the reactions to set
	 */
	public void setReactions(ArrayList<Reaction> reactions) {
		this.reactions = reactions;
	}

	/**
	 * @return the relations
	 */
	public ArrayList<Relation> getRelations() {
		return relations;
	}

	/**
	 * @param relations the relations to set
	 */
	public void setRelations(ArrayList<Relation> relations) {
		this.relations = relations;
	}

	@Override
	public TreeIterator<EObject> eAllContents() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public EClass eClass() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public EObject eContainer() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public EStructuralFeature eContainingFeature() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public EReference eContainmentFeature() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public EList<EObject> eContents() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public EList<EObject> eCrossReferences() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Object eGet(EStructuralFeature arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Object eGet(EStructuralFeature arg0, boolean arg1) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean eIsProxy() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean eIsSet(EStructuralFeature arg0) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public Resource eResource() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void eSet(EStructuralFeature arg0, Object arg1) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void eUnset(EStructuralFeature arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public EList<Adapter> eAdapters() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean eDeliver() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void eNotify(Notification arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void eSetDeliver(boolean arg0) {
		// TODO Auto-generated method stub
		
	}

}
